<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2010 osCommerce

  Released under the GNU General Public License
*/

  $oscTemplate->buildBlocks();

  if (!$oscTemplate->hasBlocks('boxes_column_left')) {
    $oscTemplate->setGridContentWidth($oscTemplate->getGridContentWidth() + $oscTemplate->getGridColumnWidth());
  }

  if (!$oscTemplate->hasBlocks('boxes_column_right')) {
    $oscTemplate->setGridContentWidth($oscTemplate->getGridContentWidth() + $oscTemplate->getGridColumnWidth());
  }
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>" />
<title><?php echo tep_output_string_protected($oscTemplate->getTitle()); ?></title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>" />


    <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>

    <script type="text/javascript" src="globalScripts.js"></script>



    <script type="text/javascript">
     $(document).ready(function(){

         $("header ul li a span").append("<span></span>");
         $("#breadCrumb ul li a span").append("<span></span>");
         $("section.subCategory table tr td.buyNow a span").append("<span></span>");
         $("ul#buttons li a span, ul#buttons li button span, #checkoutButton span").append("<span></span>");
      });

    </script>


<script type="text/javascript">
     $(document).ready(function(){


         var loggedIn = "<?php if (tep_session_is_registered('customer_id')) { echo ('loggedIn'); } else { echo ('notLoggedIn'); } ?>";

         console.log(loggedIn);

         $("#signIn a").click(function(loadLogin){
             loadLogin.preventDefault();
             $("#loginDiv").load("login.php", function(){
                 $("#loginDiv").prepend('<span class="closeMe">close</span>');
             });
             $('#loginDiv').fadeIn(200);
         });

         $(".closeMe").live('click',function(){
             $(this).parent().fadeOut(600);
         });

        // controls the login functionality
        if (loggedIn == "notLoggedIn") {
             $("#myAccount a").click(function(loadLogin){
                 loadLogin.preventDefault();
                 $("#loginDiv").hide().load("login.php", function(){
                    $("#loginDiv").fadeIn(600).prepend('<span class="closeMe">close</span>');
                 });
             });


            $("#login").live('submit',function() {
                console.log('hitting it');
                var pageHandler = "<?php echo(tep_href_link(FILENAME_LOGIN_SCRIPT, 'action=process', 'SSL')) ?>";
                var email_address = $("#email_address").val();
                var password = $("#password").val();
                var formid = $("#formid").val();
                console.log(password + email_address);
                $.post(pageHandler, { email_address: email_address, password: password, formid: formid }, function(data) {
                    console.log('got in');
                    $("#error").html(data);
                });
                console.log('got here');
                return false;

            });
        }
        // end controls the login functionality


      });

</script>


<?php
  if (tep_not_null(JQUERY_DATEPICKER_I18N_CODE)) {
?>
<script type="text/javascript" src="ext/jquery/ui/i18n/jquery.ui.datepicker-<?php echo JQUERY_DATEPICKER_I18N_CODE; ?>.js"></script>
<script type="text/javascript">
$.datepicker.setDefaults($.datepicker.regional['<?php echo JQUERY_DATEPICKER_I18N_CODE; ?>']);
</script>
<?php
  }
?>

<script type="text/javascript" src="ext/jquery/bxGallery/jquery.bxGallery.1.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="ext/jquery/fancybox/jquery.fancybox-1.3.4.css" />
<script type="text/javascript" src="ext/jquery/fancybox/jquery.fancybox-1.3.4.pack.js"></script>



   <style type="text/css">
       @import "css.css";

   </style>



    <?php echo $oscTemplate->getBlocks('header_tags'); ?>
</head>
<body>


<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
